package com.hyz.yuaiagent;

import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.util.stream.IntStream;

@Slf4j
public class Reqest {

    private static final String URL = "http://184.73.144.121/";

    @Test
    public void pressureTest() {
        // 每个 i 发 6 次请求，总共 1000*6=6000 次
        IntStream.range(0, 1000).parallel().forEach(i -> {
            for (int j = 0; j < 6; j++) {
                HttpUtil.get(URL);
            }
            // 每 100 轮打印一次进度
            if (i % 100 == 0) {
                log.info("Completed {} rounds ({} requests)", i, i * 6);
            }
        });
        log.info("All pressure test requests completed.");
    }
}
